//
// Created by baigui on 21-7-16.
//

#ifndef SIMPLE_PLAYER_MEDIASTREAM_H
#define SIMPLE_PLAYER_MEDIASTREAM_H

#include<memory>
#include "Demux.h"

using namespace std;

class VideoDecoder;
class VideoRender;
class Demux;
enum MediaStreamType{
    video = 1,
    audio = 2,
    spu = 3
};

enum MediaStreamState{
    UN_INIT = 0,
    INIT = 2,
    SELCECT = 3,
    PLATRING = 4
};

struct Videoinfo {
    int i_frame_rate;
    int i_frame_rate_base;
    int width;
    int height;
};

struct Audioinfo {
    int width;
    int height;
};

class MediaStream {
public:
    MediaStream(){
    }
    ~MediaStream(){
    }
    int id;
    int languge;
    const char *formate;
    int codeType;

    union {
        Videoinfo video;
        Audioinfo audio;
    };
    long durationUs;
    int track_id;
    shared_ptr<MediaStream> next;
    const char *mime;
    weak_ptr<VideoDecoder> decoder;
    weak_ptr<VideoRender> render;
    weak_ptr<Demux> demux;

    enum MediaStreamType type;
    enum MediaStreamState state;
};

#endif //SIMPLE_PLAYER_MEDIASTREAM_H
